

import java.io.DataInputStream;
import java.util.List;

/**
 * 
 * Using for keeping RequestThread from the other irrelevant method.
 * 
 * @author yuxuanzhang
 *
 */
abstract class SocketThreadWrapper {	
	List<RequestThread> activeThreadList;
	
	protected SocketThreadWrapper(List<RequestThread> list) {
		this.activeThreadList = list;
	}
	
	protected abstract void failure(Exception e, String message, boolean aboutThisSocket, int requestNum);
	protected abstract void success(DataInputStream in);
	
	protected boolean removeFromActiveList(RequestThread thread) {
		if (activeThreadList.contains(thread)) {
			activeThreadList.remove(thread);
			return true;
		}
		return false;
	}
}
